/*
 * Copyright 2011 Clean GWT
 * 
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
 * in compliance with the License. You may obtain a copy of the License at
 * 
 * http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software distributed under the License
 * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
 * or implied. See the License for the specific language governing permissions and limitations under
 * the License.
 */
package com.cleangwt.bootstrap.client.style;

import com.google.gwt.user.client.ui.Widget;

/**
 * This class provides label styles.
 * 
 * @author Jess
 * @version 1.0
 * @since 1.0
 */
public class Labels {
  /**
   * The label style
   */
  public static final String LABEL_STYLE = "label";
  /**
   * The base style
   */
  public static final String DEFAULT_STYLE = "label-default";
  /**
   * The base style
   */
  public static final String PRIMARY_STYLE = "label-primary";
  /**
   * The base style
   */
  public static final String SUCCESS_STYLE = "label-success";
  /**
   * The base style
   */
  public static final String WARNING_STYLE = "label-warning";
  /**
   * The base style
   */
  public static final String DANGER_STYLE = "label-danger";
  /**
   * The base style
   */
  public static final String INFO_STYLE = "label-info";

  /**
   * Sets the style name with base {@link #LABEL_STYLE} for the given widget.
   * 
   * @param style the base style
   * @param widget the widget
   * @return the widget itself
   */
  public static Widget style(String style, Widget w) {
    assert style != null : "Stye must not be null.";
    w.setStyleName(LABEL_STYLE + " " + style);
    return w;
  }

  /**
   * Sets {@link #DEFAULT_STYLE} with base {@link #LABEL_STYLE} for the given widget.
   * 
   * @param widget the widget
   * @return the widget itself
   */
  public static Widget style(Widget w) {
    return style(DEFAULT_STYLE, w);
  }

  /**
   * Sets {@link #PRIMARY_STYLE} with base {@link #LABEL_STYLE} for the given widget.
   * 
   * @param widget the widget
   * @return the widget itself
   */
  public static Widget primary(Widget w) {
    return style(PRIMARY_STYLE, w);
  }

  /**
   * Sets {@link #INFO_STYLE} with base {@link #LABEL_STYLE} for the given widget.
   * 
   * @param widget the widget
   * @return the widget itself
   */
  public static Widget info(Widget w) {
    return style(INFO_STYLE, w);
  }

  /**
   * Sets {@link #SUCCESS_STYLE} with base {@link #LABEL_STYLE} for the given widget.
   * 
   * @param widget the widget
   * @return the widget itself
   */
  public static Widget success(Widget w) {
    return style(SUCCESS_STYLE, w);
  }

  /**
   * Sets {@link #WARNING_STYLE} with base {@link #LABEL_STYLE} for the given widget.
   * 
   * @param widget the widget
   * @return the widget itself
   */
  public static Widget warning(Widget w) {
    return style(WARNING_STYLE, w);
  }

  /**
   * Sets {@link #DANGER_STYLE} with base {@link #LABEL_STYLE} for the given widget.
   * 
   * @param widget the widget
   * @return the widget itself
   */
  public static Widget danger(Widget w) {
    return style(DANGER_STYLE, w);
  }

}
